﻿@{
    ViewBag.Title = "管理首页";
    Layout = "~/Areas/Backend/Views/Shared/_Layout.cshtml";
}
@section bodyAttr{ class="index-body"}
<div id="backend-container">
    <div id="backend-top">
        <a id="switch-module" title="更多模块" class="backend-top-menu border-right monk-iconfont icon-backend-module"></a>
        <a title="返回前页" class="backend-top-menu border-right monk-iconfont icon-backend-back" onclick="history.go(-1);"></a>
        <a title="刷新页面" class="backend-top-menu border-right monk-iconfont icon-backend-refresh" onclick="document.getElementById('backend-iframe').contentWindow.location.reload(true);"></a>
        <a href="/" target="_blank" title="查看网站" class="backend-top-menu border-right monk-iconfont icon-backend-website"></a>
        <a title="会员信息" class="backend-top-menu border-left monk-iconfont icon-backend-account float-right"></a>
        <a title="退出管理" class="backend-top-menu border-left monk-iconfont icon-backend-tuichu float-right" id="signout"></a>
    </div>
    <div id="backend-left">
        <div id="backend-logo">
            <a href="@ViewBag.SysSetInfo.Site" target="_blank" class="" title="@ViewBag.SysSetInfo.Name">
                <img src="@ViewBag.SysSetInfo.Logo" class="display-block" alt="系统标志" title="系统标志" onerror="this.src = '/Areas/Backend/Assets/Images/baisoft-logo.png'" />
            </a>
        </div>
        <div id="backend-left-menu">
            <div class="backend-menu-item display-none" data-moduleid="1">
                <h2 class="backend-menu-title">站点管理</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>站点设置</label>
                            </div>
                        </li>
                        <li>
                            <div data-url="@Url.Action("Console","Default")" target="backend-iframe" class="backend-menu-action" data-actionid="2">
                                <span class="monk-iconfont icon-backend-folder-close action-icon"></span><label>内容管理</label>
                                <span class="monk-iconfont icon-arrow icon-monk-arrowdown float-right"></span>
                            </div>
                            <ul>
                                <li>
                                    <div data-url="@Url.Action("Console","Default")" target="backend-iframe" class="backend-menu-action" data-actionid="3">
                                        <span class="space"></span><span class="monk-iconfont icon-backend-file action-icon"></span><label>内容分类</label>
                                    </div>
                                </li>
                                <li>
                                    <div data-url="@Url.Action("Console","Default")" target="backend-iframe" class="backend-menu-action" data-actionid="4">
                                        <span class="space"></span><span class="monk-iconfont icon-backend-file action-icon"></span><label>内容分类</label>
                                    </div>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <div data-url="@Url.Action("Console","Default")" target="backend-iframe" class="backend-menu-action" data-actionid="5">
                                <span class="monk-iconfont icon-backend-folder-close action-icon"></span><label>其他设置</label>
                                <span class="monk-iconfont icon-arrow icon-monk-arrowdown float-right"></span>
                            </div>
                            <ul>
                                <li>
                                    <div data-url="@Url.Action("Console","Default")" target="backend-iframe" class="backend-menu-action" data-actionid="6">
                                        <span class="space"></span><span class="monk-iconfont icon-backend-file action-icon"></span><label>内容分类</label>
                                    </div>
                                </li>
                                <li>
                                    <div data-url="@Url.Action("Console","Default")" target="backend-iframe" class="backend-menu-action" data-actionid="7">
                                        <span class="space"></span><span class="monk-iconfont icon-backend-file action-icon"></span><label>内容分类</label>
                                    </div>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="2">
                <h2 class="backend-menu-title">微信管理</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="wx1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="3">
                <h2 class="backend-menu-title">移动管理</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="yd1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="4">
                <h2 class="backend-menu-title">客户管理</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="kh1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="5">
                <h2 class="backend-menu-title">企业管理</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="qy1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="6">
                <h2 class="backend-menu-title">项目管理</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="xm1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="7">
                <h2 class="backend-menu-title">社区论坛</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="sq1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="8">
                <h2 class="backend-menu-title">在线文档</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="wd1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="9">
                <h2 class="backend-menu-title">用户授权</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="sq1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="10">
                <h2 class="backend-menu-title">跳蚤市场</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="tz1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="13">
                <h2 class="backend-menu-title">商城管理</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="sc1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="11">
                <h2 class="backend-menu-title">站长工具</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="http://www.baisoft.org/public/monkui/" target="backend-iframe" class="backend-menu-action" data-actionid="zz1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>基本设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="12">
                <h2 class="backend-menu-title">数据维护</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="#" target="backend-iframe" class="backend-menu-action" data-actionid="2ac">
                                <span class="monk-iconfont icon-backend-folder-close action-icon"></span><label>日志管理</label>
                                <span class="monk-iconfont icon-arrow icon-monk-arrowdown float-right"></span>
                            </div>
                            <ul>
                                <li>
                                    <div data-url="@Url.Action("Select","LoginLog")" target="backend-iframe" class="backend-menu-action" data-actionid="3bc">
                                        <span class="space"></span><span class="monk-iconfont icon-backend-file action-icon"></span><label>登录日志</label>
                                    </div>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="backend-menu-item display-none" data-moduleid="14">
                <h2 class="backend-menu-title">系统设置</h2>
                <div class="backe-menu-list">
                    <ul>
                        <li>
                            <div data-url="@Url.Action("Detail","SysSet")" target="backend-iframe" class="backend-menu-action" data-actionid="xt1">
                                <span class="monk-iconfont icon-backend-file action-icon"></span><label>系统设置</label>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div id="backend-right">
        <iframe frameborder="0" src="@Url.Action("Console","Default")" id="backend-iframe" name="backend-iframe"></iframe>
    </div>
</div>
<div id="backend-module">
    <div class="backend-module-item" data-moduleid="1">
        <a title="">
            <span class="monk-iconfont icon-backend-zhandian"></span>
            <label>站点管理</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="2">
        <a title="">
            <span class="monk-iconfont icon-backend-weixin"></span>
            <label>微信管理</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="3">
        <a title="">
            <span class="monk-iconfont icon-backend-yidong"></span>
            <label>移动管理</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="4">
        <a title="">
            <span class="monk-iconfont icon-backend-kehu"></span>
            <label>客户管理</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="5">
        <a title="">
            <span class="monk-iconfont icon-backend-qiye"></span>
            <label>企业管理</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="6">
        <a title="">
            <span class="monk-iconfont icon-backend-xiangmu"></span>
            <label>项目管理</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="7">
        <a title="">
            <span class="monk-iconfont icon-backend-luntan"></span>
            <label>社区论坛</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="8">
        <a title="">
            <span class="monk-iconfont icon-backend-wendan"></span>
            <label>在线文档</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="9">
        <a title="">
            <span class="monk-iconfont icon-backend-shouquan"></span>
            <label>用户授权</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="10">
        <a title="">
            <span class="monk-iconfont icon-backend-jishishichang"></span>
            <label>跳蚤市场</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="13">
        <a title="">
            <span class="monk-iconfont icon-backend-shangcheng"></span>
            <label>商城管理</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="11">
        <a title="">
            <span class="monk-iconfont icon-backend-zhanzhanggongju"></span>
            <label>站长工具</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="12">
        <a title="">
            <span class="monk-iconfont icon-backend-shuju"></span>
            <label>数据维护</label>
        </a>
    </div>
    <div class="backend-module-item" data-moduleid="14">
        <a title="">
            <span class="monk-iconfont icon-backend-xitong"></span>
            <label>系统管理</label>
        </a>
    </div>
</div>

@section foot{
    @Scripts.Render("~/Assets/Backend/Nicescroll/Script")
    <script type="text/javascript">
        if (self != top) { top.location = self.location; }
        $(function () {
            backend.successTip("您好，@ViewBag.MemberInfo.Account");
            // 模块处理
            var moduleStatusKey = "@ViewBag.MemberInfo.Account" + "_moduleStatus";
            var $container = $("#backend-container");
            var $module = $("#backend-module");
            var moduleWidth = $module.outerWidth(true);
            var speed = 300;
            if (store.get(moduleStatusKey) == "open") {
                $container.animate({
                    left: moduleWidth + "px"
                }, speed);
                $module.animate({
                    left: 0
                }, speed);
            }
            var nicescrolls = backend.nicescroll($module.add($(".backe-menu-list")));
            $("#switch-module").on({
                click: function () {
                    if (!$module.is(":animated") && !$container.is(":animated")) {
                        if (store.get(moduleStatusKey) == "open") {
                            $container.animate({
                                left: 0
                            }, speed);
                            $module.animate({
                                left: -moduleWidth + "px"
                            }, speed);
                            store.set(moduleStatusKey, "close");
                        }
                        else {
                            $container.animate({
                                left: moduleWidth + "px"
                            }, speed);
                            $module.animate({
                                left: 0
                            }, speed);
                            store.set(moduleStatusKey, "open");
                        }
                    }
                }
            });

            // 点击模块处理
            var moduleIdKey = "@ViewBag.MemberInfo.Account" + "_moduleId";
            $("#backend-module").on("click", ".backend-module-item", function () {
                var lastModuleid = store.get(moduleIdKey);
                if (lastModuleid) {
                    $(".backend-menu-item[data-moduleid='" + lastModuleid + "']").addClass("display-none");
                    $(".backend-module-item[data-moduleid='" + lastModuleid + "']").children("a").removeClass("selected");
                }
                var that = $(this);
                var moduleid = that.attr("data-moduleid");
                $(".backend-menu-item[data-moduleid='" + moduleid + "']").removeClass("display-none");
                that.children("a").addClass("selected");
                store.set(moduleIdKey, moduleid);
            });
            if (store.get(moduleIdKey)) {
                $(".backend-module-item[data-moduleid='" + store.get(moduleIdKey) + "']").click();
            }
            else {
                $(".backend-module-item").eq(0).click();
            }

            // 功能菜单处理
            var actionidKey = "@ViewBag.MemberInfo.Account" + "_actionId";
            $("#backend-left").on("click", ".backend-menu-action", function (e, data) {
                var lastActionid = store.get(actionidKey);
                if (lastActionid) {
                    $(".backend-menu-action[data-actionid='" + lastActionid + "']").removeClass("selected");
                }
                var that = $(this);
                var ul = that.siblings("ul");
                var url = that.attr("data-url");
                var actionid = that.attr("data-actionid");
                var childrenKey = store.get(actionid + "_actionidChildrenKey");
                var target = that.attr("target");
                that.addClass("selected");
                if (url && url != "#") {
                    if (target == "backend-iframe") {
                        document.getElementById('backend-iframe').contentWindow.location.href = url;
                    }
                    else {
                        window.location.href = url;
                    }
                }
                if (data == "auto") {
                    that.parents("ul").each(function () {
                        var _menuItem = $(this).siblings(".backend-menu-action");
                        _menuItem.children(".icon-arrow").removeClass("icon-monk-arrowdown").addClass("icon-monk-arrowup");
                        _menuItem.children(".action-icon").removeClass("icon-backend-folder-close").addClass("icon-backend-folder-open");
                        $(this).show();
                    });
                }
                if (ul.length > 0) {
                    if (data != "auto") {
                        if (ul.is(":visible")) {
                            that.children(".icon-arrow").removeClass("icon-monk-arrowup").addClass("icon-monk-arrowdown");
                            that.children(".action-icon").removeClass("icon-backend-folder-open").addClass("icon-backend-folder-close");
                            ul.hide();
                            store.set(actionid + "_actionidChildrenKey", "close");
                        }
                        else {
                            that.children(".icon-arrow").removeClass("icon-monk-arrowdown").addClass("icon-monk-arrowup");
                            that.children(".action-icon").removeClass("icon-backend-folder-close").addClass("icon-backend-folder-open");
                            ul.show();
                            store.set(actionid + "_actionidChildrenKey", "open");
                        }
                    }
                    else {
                        if (childrenKey == "open") {
                            that.parent("ul").show();
                            that.children(".icon-arrow").removeClass("icon-monk-arrowdown").addClass("icon-monk-arrowup");
                            that.children(".action-icon").removeClass("icon-backend-folder-close").addClass("icon-backend-folder-open");
                            ul.show();
                        }
                        else {
                            that.children(".icon-arrow").removeClass("icon-monk-arrowup").addClass("icon-monk-arrowdown");
                            that.children(".action-icon").removeClass("icon-backend-folder-open").addClass("icon-backend-folder-close");
                            ul.hide();
                        }
                    }
                }
                store.set(actionidKey, actionid);
            });
            if (store.get(actionidKey)) {
                $(".backend-menu-action[data-actionid='" + store.get(actionidKey) + "']").trigger("click", "auto");
            }

            // 退出系统
            $("#signout").on({
                click: function () {
                    backend.loadTip("系统正在注销，请稍后...")
                    $.post("@Url.Action("Signout", "Default")", {}, function (data) {
                        backend.ajaxResultHandle(data, function (data) {
                            if (data.status == "n") {
                                backend.errorTip(data.info);
                            }
                            else if (data.status == "y") {
                                backend.successTip(data.info, { time: 1000 }, function () {
                                    window.location.href = '@Url.Action("Signin", "Default")';
                                });
                            }
                        });
                    });
                }
            });
        });
    </script>
}